package com.hang.springrabbitmq.hello.consumer;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;


@Component
public class HelloConsumer {

    @RabbitHandler//当消费者从队列取出消息时的回调方法
    @RabbitListener(queuesToDeclare = @Queue(value = "hello"))
    public void receive(String message){
        System.out.println("message:"+message);
    }
}
